SpritePool Class
Holds a pool of different Sprites that can be created, makes it very easy to quickly create different registered entities
Constructor
Methods
add
(
Sprite
-
name -
obj
Adds an Sprite Type to the pool
Parameters:
-
nameStringThe user-defined name of the Sprite Type to add
-
objSpriteThe Sprite or decendant type to add to the pool
Returns:
Sprite:
Returns the passed sprite
create
(
Sprite
-
name -
texture -
props
Creates a new sprite from the pool
Parameters:
-
nameStringThe user-defined name of the Sprite to check if is in the pool
-
textureTextureThe texture for the sprite
-
propsObjectExtra object that will be passed along (for custom sprite options)
Returns:
Sprite:
Returns a new instance of the object from the pool
free
()
Frees an object back into the pool to be recycled, currently doesn't do any recycling unfortunately
has
(
Boolean
-
name
Checks if the Sprite Type exists in the pool
Parameters:
-
nameStringThe user-defined name of the Sprite Type to check if is in the pool
Returns:
Boolean: